﻿using Domain.Entities;
using FluentMigrator;
using FrameworkCore.Extensions;

namespace Application.Features.Groups.Migrations;

[Migration(202408291146)]
public class GroupAddInitColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(MigrationExpressions.GetTableName(typeof(Group)))
            .AddColumn(MigrationExpressions.ColumnNameFor<Group>(nameof(Group.Groupname))).AsString(36).WithColumnDescription("组名").Nullable()
            .AddColumn(MigrationExpressions.ColumnNameFor<Group>(nameof(Group.Code))).AsString(36).WithColumnDescription("编码").Nullable()
            .AddColumn(MigrationExpressions.ColumnNameFor<Group>(nameof(Group.IsVillain))).AsBoolean().WithColumnDescription("是否反面（多用于互斥逻辑）").WithDefaultValue(false).Nullable()
            .AddColumn(MigrationExpressions.ColumnNameFor<Group>(nameof(Group.ParentId))).AsInt64().WithColumnDescription("父级节点").Nullable();
    }
}

